﻿@using Resources
@model NetSurveillance.WebApp.Models.MultiSearchModel
@{
    ViewBag.Title = "综合查询";
    Layout = "~/Views/Shared/_SimpleLayout.cshtml";
}
@section css
{
    <style type="text/css">
        .showdia_qq_left_tree {
            height: 505px;
        }
    </style>
}
@section javascript
{
    <script type="text/javascript">
        $(function () {
            $('#ddSelect dd label').live('click', function() {
                var $dd = $(this).parent(), searchId = $dd.attr('data-entryId');
                window.location.href = '@Url.Action("Search")' + '?searchId=' + searchId + '&__randomDate=' + (new Date()).getTime();
                return false;
            });

            $("#chk_showdialog_complex_right_selectall").bind("click", function() {
                var temp = $(this).attr("checked");
                if (temp) {
                    $("#ddSelect>dd>:checkbox").attr("checked", true);
                } else {
                    $("#ddSelect>dd>:checkbox").attr("checked", false);
                }
            });

            $("#btn_showdialog_complex_right_del").bind("click", function () {
                var arr = new Array();
                $('#ddSelect input[name="searchCondirion"]:checked').each(function (index, item) {
                    arr.push(item.value);
                });
                var ids = arr.join(",");
                if (!ids) { alert("请选择要删除的查询条件!"); return; }
                $.showLoading('@MessageResource.Delete_Loading');
                $.ajax({
                    url: '@Url.Action("DeleteSearch")',
                    type: 'post',
                    dataType: 'json',
                    data: { searchIds: ids },
                    success: function (result) {
                        if (result.Success) {
                            $(arr).each(function (index, item) {
                                $('#ddSelect dd[data-entryId=' + item + ']').remove();
                                $("#chk_showdialog_complex_right_selectall").attr("checked", false);
                            });
                        } else {
                            alert(result.Message);
                        }
                        $.hideLoading();
                    }
                });
            });
            var datepickerOpts = {
                dateFormat: 'yy-m-dd',
                showMonthAfterYear: true,
                constrainInput: true,
                changeMonth: true,
                changeYear: true,
                autoSize: false,
                showButtonPanel: true
            };
            $("#txt_monitor_startDate,#txt_monitor_endDate,#txt_monitor_emailDate").datepicker(datepickerOpts);

            $('#btn_showdia_complex_cancel').click(windowClose);
        });
        
        function submitQuery() {
            var qqSearchEntry = {};
            qqSearchEntry.Protocol = $("#ddl_jkxy").val();
            qqSearchEntry.Subject = $("#txt_monitor_subject").val().trim();
            qqSearchEntry.StartDate = $("#txt_monitor_startDate").val().trim();
            qqSearchEntry.EndDate = $("#txt_monitor_endDate").val().trim();
            qqSearchEntry.Account = $("#txt_monitor_account").val().trim();
            qqSearchEntry.Password = $("#txt_monitor_password").val().trim();
            qqSearchEntry.IP = $("#txt_monitor_ip").val().trim();
            qqSearchEntry.Mac = $("#txt_monitor_mac").val().trim();
            qqSearchEntry.RemoteIP = $("#txt_monitor_remoteIp").val().trim();
            qqSearchEntry.RemoteMac = $("#txt_monitor_remoteMac").val().trim();
            qqSearchEntry.MailFrom = $("#txt_monitor_emailFrom").val().trim();
            qqSearchEntry.MailTo = $("#txt_monitor_emailTo").val().trim();
            qqSearchEntry.MailCC = $("#txt_monitor_emailCc").val().trim();
            qqSearchEntry.MailDate = $("#txt_monitor_emailDate").val().trim();
            qqSearchEntry.SystemInfo = $("#txt_monitor_systemInfo").val().trim();
            qqSearchEntry.SoftvareVer = $("#txt_monitor_clientVer").val().trim();
            qqSearchEntry.FileType = $("#txt_monitor_fileType").val().trim();
            qqSearchEntry.Url = $("#txt_monitor_url").val().trim();
            qqSearchEntry.Id = $('#txt_searchId').val();
            qqSearchEntry.SearchFrom = '@Model.SearchFrom';
            qqSearchEntry.HostIds = getCheckHostIds();
            var seachUrl = "@Url.Action("SearchResult")",
                params = $.param(qqSearchEntry, true);
            seachUrl = seachUrl + "?" + params;
            (window.opener || window.dialogArguments).location.href = seachUrl;
            window.close();
        }
        
        function windowClose() {
            if (!window.confirm('@MessageResource.ExitConfirm')) return;
            window.close();
        }
    </script>
}
<div class="showdia_qq_content">
    <div class="showdia_qq_left">
        <div class="showdia_qq_left_title">
            @ViewResource.HostListTitle
        </div>
        <div class="showdia_qq_left_tree">
            @Html.Partial("../Host/_HostTree", ViewBag.TreeNode as string)
        </div>
    </div>
    @using (Html.BeginForm())
    {
        @Html.ValidationSummary()
        @Html.HiddenFor(m => m.SearchFrom)
        <div class="showdia_complex_middle">
            <div class="showdialog_complex_middle_title">
                &nbsp;&nbsp;筛选字段
            </div>
            @Html.HiddenFor(m => m.Id, new { id = "txt_searchId" })
            <ul class="showdia_complex_middle_ul">
                <li>
                    <dl class="showdia_complex_middle_dl">
                        <dt>@Html.LabelFor(m => m.Protocol)</dt>
                        <dd>
                            <div class="complex_select_border01">
                                @Html.DropDownListFor(m => m.Protocol, ViewBag.Protocols as SelectList,
                                                      Resource.DropdownList_Select, new { id = "ddl_jkxy" })
                            </div>
                        </dd>
                    </dl>
                </li>
                <li>
                    <dl class="showdia_complex_middle_dl">
                        <dt>@Html.LabelFor(m => m.Subject)</dt>
                        <dd>
                            <div class="complex_select_bordertxt1">
                                @Html.TextBoxFor(m => m.Subject, new { id = "txt_monitor_subject" })

                            </div>
                            @Html.ValidationMessageFor(m => m.Subject)

                        </dd>
                    </dl>
                </li>
                <li>
                    <dl class="showdia_complex_middle_dl">
                        <dt>时间</dt>
                        <dd>
                            <div class="showdia_complex_middle_dl_text">@Html.LabelFor(m => m.StartDate)</div>
                            <div class="complex_select_border02">
                                @Html.TextBox("StartDate",
                                              Model != null && Model.StartDate.HasValue?string.Format("{0:yyyy-MM-dd}",Model.StartDate):null,
                                              new{id="txt_monitor_startDate",@readonly=true})
                            </div>
                            @Html.ValidationMessageFor(m => m.StartDate)
                        </dd>
                        <dd>
                            <div class="showdia_complex_middle_dl_text">@Html.LabelFor(m => m.EndDate)</div>
                            <div class="complex_select_border02">
                                @Html.TextBox("EndDate",
                                              Model != null && Model.EndDate.HasValue?string.Format("{0:yyyy-MM-dd}",Model.EndDate):null,
                                              new{id="txt_monitor_endDate",@readonly=true})
                            </div>
                            @Html.ValidationMessageFor(m => m.EndDate)
                        </dd>
                    </dl>
                </li>
                <li>
                    <dl class="showdia_complex_middle_dl">
                        <dt>账号</dt>
                        <dd>
                            <div class="showdia_complex_middle_dl_text">@Html.LabelFor(m => m.Account)</div>
                            <div class="complex_select_border02">
                                @Html.TextBoxFor(m => m.Account, new { id = "txt_monitor_account" })

                            </div>
                            @Html.ValidationMessageFor(m => m.Account)
                        </dd>
                        <dd>
                            <div class="showdia_complex_middle_dl_text">@Html.LabelFor(m => m.Password)</div>
                            <div class="complex_select_border02">
                                @Html.TextBoxFor(m => m.Password, new { id = "txt_monitor_password" })

                            </div>
                            @Html.ValidationMessageFor(m => m.Password)
                        </dd>
                    </dl>
                </li>
                <li>
                    <dl class="showdia_complex_middle_dl">
                        <dt>计算机地址</dt>
                        <dd>
                            <div class="showdia_complex_middle_dl_text">@Html.LabelFor(m => m.IP)</div>
                            <div class="complex_select_border02">
                                @Html.TextBoxFor(m => m.IP, new { id = "txt_monitor_ip" })

                            </div>
                            @Html.ValidationMessageFor(m => m.IP)
                        </dd>
                        <dd>
                            <div class="showdia_complex_middle_dl_text">@Html.LabelFor(m => m.Mac)</div>
                            <div class="complex_select_border02">
                                @Html.TextBoxFor(m => m.Mac, new { id = "txt_monitor_mac" })

                            </div>
                            @Html.ValidationMessageFor(m => m.Mac)
                        </dd>
                        <dd>
                            <div class="showdia_complex_middle_dl_text">@Html.LabelFor(m => m.RemoteIP)</div>
                            <div class="complex_select_border02">
                                @Html.TextBoxFor(m => m.RemoteIP, new { id = "txt_monitor_remoteIp" })

                            </div>
                            @Html.ValidationMessageFor(m => m.RemoteIP)
                        </dd>
                        <dd>
                            <div class="showdia_complex_middle_dl_text">@Html.LabelFor(m => m.RemoteMac)</div>
                            <div class="complex_select_border02">
                                @Html.TextBoxFor(m => m.RemoteMac, new { id = "txt_monitor_remoteMac" })

                            </div>
                            @Html.ValidationMessageFor(m => m.RemoteMac)
                        </dd>
                    </dl>
                </li>
                <li>
                    <dl class="showdia_complex_middle_dl">
                        <dt>邮件</dt>
                        <dd>
                            <div class="showdia_complex_middle_dl_text">@Html.LabelFor(m => m.EmailFrom)</div>
                            <div class="complex_select_border02">
                                @Html.TextBoxFor(m => m.EmailFrom, new { id = "txt_monitor_emailFrom" })

                            </div>
                            @Html.ValidationMessageFor(m => m.EmailFrom)
                        </dd>
                        <dd>
                            <div class="showdia_complex_middle_dl_text">@Html.LabelFor(m => m.EmailTo)</div>
                            <div class="complex_select_border02">
                                @Html.TextBoxFor(m => m.EmailTo, new { id = "txt_monitor_emailTo" })

                            </div>
                            @Html.ValidationMessageFor(m => m.EmailTo)
                        </dd>
                        <dd>
                            <div class="showdia_complex_middle_dl_text">@Html.LabelFor(m => m.EmailCC)</div>
                            <div class="complex_select_border02">
                                @Html.TextBoxFor(m => m.EmailCC, new { id = "txt_monitor_emailCc" })

                            </div>@Html.ValidationMessageFor(m => m.EmailCC)
                        </dd>
                        <dd>
                            <div class="showdia_complex_middle_dl_text">@Html.LabelFor(m => m.EmailDate)</div>
                            <div class="complex_select_border02">
                                @Html.TextBox("EmailDate",
                                              Model != null && Model.EmailDate.HasValue?string.Format("{0:yyyy-MM-dd}",Model.EmailDate):null,
                                              new{id="txt_monitor_emailDate",@readonly=true})
                            </div>
                            @Html.ValidationMessageFor(m => m.EmailDate)
                        </dd>
                    </dl>
                </li>
                <li>
                    <dl class="showdia_complex_middle_dl">
                        <dt>系统及软件</dt>
                        <dd>
                            <div class="showdia_complex_middle_dl_text">@Html.LabelFor(m => m.SystemInfo)</div>
                            <div class="complex_select_border02">
                                @Html.TextBoxFor(m => m.SystemInfo, new { id = "txt_monitor_systemInfo" })

                            </div>@Html.ValidationMessageFor(m => m.SystemInfo)
                        </dd>
                        <dd>
                            <div class="showdia_complex_middle_dl_text">@Html.LabelFor(m => m.ClientVer)</div>
                            <div class="complex_select_border02">
                                @Html.TextBoxFor(m => m.ClientVer, new { id = "txt_monitor_clientVer" })
                            </div>@Html.ValidationMessageFor(m => m.ClientVer)
                        </dd>
                    </dl>
                </li>
                <li>
                    <dl class="showdia_complex_middle_dl">
                        <dt>下载上传信息</dt>
                        <dd>
                            <div class="showdia_complex_middle_dl_text">@Html.LabelFor(m => m.FileType)</div>
                            <div class="complex_select_border02">
                                @Html.TextBoxFor(m => m.FileType, new { id = "txt_monitor_fileType" })
                            </div>@Html.ValidationMessageFor(m => m.FileType)
                        </dd>
                        <dd>
                            <div class="showdia_complex_middle_dl_text">@Html.LabelFor(m => m.Url)</div>
                            <div class="complex_select_border02">
                                @Html.TextBoxFor(m => m.Url, new { id = "txt_monitor_url" })
                            </div>
                            @Html.ValidationMessageFor(m => m.Url)
                        </dd>
                    </dl>
                </li>
            </ul>

        </div> 
        <dl class="showdia_complex_right">
            @Html.Action("CheckQueryLists", "Search", new { type = "search" })
        </dl> 
        <div class="showdia_qq_bottom">
            <div class="showdia_complex_bottom_btns">
                <ul class="config_bottom_btndivs03">
                    <li>
                        <input type="button" id="btn_showdia_complex_submit" value="提交查询" onclick="submitQuery();" /></li>
                    <li>
                        <input type="submit" id="btn_showdia_complex_save" value="保存查询" /></li>
                    <li>
                        <input type="reset" id="btn_showdia_complex_reset" value="重置查询" /></li>
                    <li>
                        <input type="button" id="btn_showdia_complex_cancel" value="@Resource.Button_Exit" /></li>
                </ul>
            </div>
        </div>
        <div class="ui-helper-clearfix"></div>
    }
    <div class="ui-helper-clearfix"></div>
</div>

